import { action, computed, observable, get } from "mobx";

export class Page2Store {
    @observable i: number = 0
    @observable inner = {
        a: 1
    }

    @observable my: any = {
        tt: undefined
    }

    @action
    inc() {
        this.i = this.i + 1
    }

    @action
    incInner() {
        this.inner.a = this.inner.a + 1
    }

    @computed
    get renderCount() {
        //@ts-ignore
        return parseInt(this.i / 3)
    }

    @computed
    get myName() {
        //@ts-ignore
        return get(this, 'my.tt.name')
    }
}

export default new Page2Store()